package com.cedarhd.brzx.controller;

import com.cedarhd.brzx.common.JsonResult;
import com.cedarhd.brzx.common.enums.ResultCode;
import com.cedarhd.brzx.domain.service.FileService;
import com.cedarhd.brzx.domain.service.SoaOrderService;
import com.cedarhd.brzx.dto.request.RechargeDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

/**
 * Created by Administrator on 2018/5/2.
 */
@RestController
@Api(value = "通联支付订单接口",description = "通联支付订单接口")
public class SoaOrderController {

    private static Logger log = LoggerFactory.getLogger(SoaOrderController.class);

    @Autowired
    private SoaOrderService soaOrderService;

    @Autowired
    private FileService fileService;

    @RequestMapping(value = Routes.SOA_ORDER_DEPOSIT_APPLY,method = RequestMethod.POST)
    @ApiOperation(value = "充值申请", notes = "充值申请", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public JsonResult depositApply(@RequestBody RechargeDTO rechargeDTO){
        log.info("depositApply param = {}",rechargeDTO);
        JSONObject response = soaOrderService.depositApply(rechargeDTO);
        if(response == null){
            JsonResult.renderMsg(ResultCode.FAILED);
        }
        return JsonResult.getFromResponse(response.toString());
    }
}
